import"../common/modulepreload-polyfill-3cfb730f.js";const t=new Vue,n={template:`
  <div>
    <p>当前组件数据：{{ title }} - 公共数据：{{ publicTitle }}</p>
    <button @click="removeEvent">移除订阅</button>
    <button @click="addEvent">添加订阅</button>
    <button @click="send">发布</button>
  </div>
  `,props:{title:{type:String,default:""}},data(){return{publicTitle:""}},mounted(){this.addEvent()},methods:{send(){t.$emit("change-title",this.title)},addEvent(){t.$on("change-title",this.eventChcange)},removeEvent(){t.$off("change-title",this.eventChcange),console.log(this.title,"移除事件监听成功")},eventChcange(e){this.publicTitle=e}}};new Vue({el:"#app",components:{usercom:n},data(){return{text:""}},mounted(){t.$on("change-title",e=>{this.text=e})},methods:{handle(){t.$emit("change-title",this.text)},clearEvent(){t.$off("change-title")}}});
